package com.soft2018;

import java.time.DayOfWeek;
import java.time.LocalDate;

public class Main {

    public static void main(String[] args) {
	// write your code here
        LocalDate date = LocalDate.now();
        int month = date.getMonthValue();
        int today = date.getDayOfMonth();

        // 将 date 设置为本月第一天
        date = date.minusDays(today -1);

        DayOfWeek weekday = date.getDayOfWeek();
        int value = weekday.getValue();

        System.out.println("星期一 星期二 星期三 星期四 星期五 星期六 星期日");
        for(int i=1;i<value;i++)
        {
            System.out.print("田田田 ");
        }
        // 打印本月日历
        while (date.getMonthValue() == month)
        {
            System.out.printf("%5d",date.getDayOfMonth());
            if(date.getDayOfMonth() == today)
            {
                System.out.print("*");
            }
            else
            {
                System.out.print(" ");
            }
            //向后加一天
            date = date.plusDays(1);
            //周一换行
            if(date.getDayOfWeek().getValue()==1)
            {
                System.out.println();
            }

        }
        if(date.getDayOfWeek().getValue()!=1)
        {
            System.out.println();
        }

    }
}
